package com.angel.bo.common.vo;


import java.util.LinkedHashMap;
import java.util.Map;

/**
 * 查询参数
 */
public class Query extends LinkedHashMap<String, Object> {
	private static final long serialVersionUID = 1L;
	//当前页码
    private int page = 1;
    //每页条数
    private int limit = 10;

    public Query(Map<String, Object> params){
        this.putAll(params);
        //分页参数
        if(params.get("pageNum")!=null) {
            this.page = Integer.parseInt(params.get("pageNum").toString());
        }
        if(params.get("pageSize")!=null) {
            this.limit = Integer.parseInt(params.get("pageSize").toString());
        }
        this.remove("pageNum");
        this.remove("pageSize");
    }

    /**
     * Constructs an empty insertion-ordered <tt>LinkedHashMap</tt> instance
     * with the default initial capacity (16) and load factor (0.75).
     */
    public Query() {
    }

    /**
     * Constructs an empty insertion-ordered <tt>LinkedHashMap</tt> instance
     * with the default initial capacity (16) and load factor (0.75).
     */
    public Query(Map<String, Object> params, Integer pageNum, Integer pageSize) {
        this.putAll(params);
        //分页参数
        if(pageNum!=null) {
            this.page = pageNum;
        }
        if(pageSize!=null) {
            this.limit = pageSize;
        }
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getLimit() {
        return limit;
    }

    public void setLimit(int limit) {
        this.limit = limit;
    }
}
